# -*- coding: utf-8 -*-
# Auther : 风雪
# Date : 2023/12/8 19:19
# File : vin_all_name.py

import requests
from requests import Response

from f6zhishu.app.f6 import F6
from f6zhishu.app.f6_one import F6

session = requests.session()


def get_dict() -> dict:
    headers = {
        "authority": "data-backend.f6car.cn",
        "accept": "application/json, text/plain, */*",
        "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
        "cache-control": "no-cache",
        "channel": "1",
        "content-type": "application/json;charset=UTF-8",
        "origin": "https://shop.f6car.cn",
        "pragma": "no-cache",
        "referer": "https://shop.f6car.cn/",
        "sec-ch-ua": "\"Microsoft Edge\";v=\"119\", \"Chromium\";v=\"119\", \"Not?A_Brand\";v=\"24\"",
        "sec-ch-ua-mobile": "?0",
        "sec-ch-ua-platform": "\"Windows\"",
        "sec-fetch-dest": "empty",
        "sec-fetch-mode": "cors",
        "sec-fetch-site": "same-site",
        "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0",
        "x-requested-with": "XMLHttpRequest"
    }
    cookies = {
            "un": "11861955597366751327",
            "f6-data-backendSESSIONID": "ca2db691-8787-4939-81b9-42c1fa1c8335",
            "sensorsdata2015jssdkcross": "%7B%22distinct_id%22%3A%2218c438640194eb-017232fd42cab17-26031051-2073600-18c4386401a330%22%2C%22first_id%22%3A%22%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%2C%22%24latest_referrer%22%3A%22%22%7D%2C%22%24device_id%22%3A%2218c438640194eb-017232fd42cab17-26031051-2073600-18c4386401a330%22%7D",
            "erpLanguage": "zh-CN"
        }
    response:Response = session.get('https://data-backend.f6car.cn/f6-data-backend/data/app/getModule?channelId=1',
                           headers=headers, cookies=cookies)
    # print(response.text)
    list = response.json()['data']
    zidian = {}
    for i in list:
        moduleName = i['moduleName']
        if moduleName == "三电系统":
            continue
        children = i['children']
        zidian[moduleName] = {}
        for j in children:
            id = j['id']
            name = j['moduleName']
            zidian[moduleName][name] = id
    return zidian


if __name__ == '__main__':
    f6 = F6()

    # dict_data = get_dict()

    vins = ['LVSHCFDB4HE337751',
            'LFMAP86C7F0592695',
            'IJ4NT4FA6BD300555',
            'LFV2A2156L3519836',
            'LGWEF4A53GH041103',
            'LSGBC5350JG172708',
            'LHGCM566732052024',
            'LFPH4ACP9K1E46010',
            'LSVBP45E9HN091118',
            'LVAV2PCBXLE444250',
            'LGWFFDA55GB000205',
            'LSGGF53WXFH108280',
            'LHGTG1828M8060867',
            'LJ8F2D5D1EBO13405',
            'LSVG446R9H2079438',
            'LFV2A21K6F4151579',
            'LS4ASJ2E3HA658027',
            'LDCC23424G1442672',
            'WDDMH4CB2CJ077956',
            'LBV8W3105KMN20740',
            'LSGKE54A4JW231299',
            'LDCC23445G1432606',
            'L6T7824Z4JN296058',
            'LC0C14DF6J0135362',
            'L6T7824Z4JN296058',
            'LGWED2A45FE015796',
            'LBEMDAEC8DZ239647',
            'LFV3A24K5M3081267',
            'L6T7722Z2KZ116835',
            'LGXC16DF6F0184268'
            ]

    # for vin in vins:
    #     f6.mian(vin)
    f6.mian('LB1WA5B34D8034590')
